package com.tyhy.program.cbc.mobileapi.enums;

public enum RedisKeyEnum {
    STATION_SEND_ECP("stationEcp","加油站派券记录"),
    STATION_SEND_ECP_COUNT("stationEcpCount","加油站派券记录统计"),
    STATION_SEND_ECP_USER("stationEcpUser","加油员派券记录"),
    STATION_SEND_ECP_USER_COUNT("stationEcpUser","加油员派券记录统计"),
    SHOP_USE_ECP("shopUseEcp","洗车房核销记录"),
    SHOP_USE_ECP_COUNT("shopUseEcp","洗车房核销记录统计"),
    USER_INFO("userInfo","用户信息"),
    STATION_CLASSES("stationClasses","加油站开班信息"),
    STATION_CLASSES_ECP("stationClassesEcp","加油站班次派券记录"),
    STATION_DAILY_ECP_SA("stationDailyEcpSA","加油站日结派券统计"),
    STATION_CLASSES_ECP_SA("stationClassesEcpSA","加油站班结派券统计"),
    FIRST_OPEN_CLASSES("firstOpenClasses","第一次开班"),
    SHOP_INFO("shopInfo","门店信息"),
    STATION_INFO("stationInfo","加油站信息"),
    SEND_ECP_EXPIRE("sendEcpExpire","派券超时时间"),
    OIL_ORDER_SEND_ECP("oilOrderSendEcp","根据订单派券"),
    /**
     * 保存服务列表,redis集合实现
     */
    EUREKA_SERVER_SET("regServer:appName","注册中心服务管理"),
    /**
     * 保存每个服务信息,redisHash实现
     * key:field:value=regServer:instance:实际服务名称,实例ID,实例信息
     */
    EUREKA_SERVER_INSTANCE("regServer:instance","注册中心服务实例"),

    LOGIN_KEY("loginKey","登录密码密文"),
    GENERAL_TIP("GENERALTIP:","前端通用提示信息前缀"),

    DISTRIBUTED_LOCK("DistributedLock","分布式锁");


    private String code;
    private String name;
    RedisKeyEnum(String code, String name){
        this.code = code;
        this.name = name;
    }

    public static String getName(String code){
        for (RedisKeyEnum obj : RedisKeyEnum.values()) {
            if(obj.getCode().equals(code)){
                return obj.getName();
            }
        }
        return "";
    }

    public String getName() {
        return name;
    }

    public String getCode() {
        return code;
    }
}
